<?php
namespace BP\Sys;
require_once("java/util/Date.php");
require_once("java/util/Enumeration.php");
abstract class FormEventBaseDtl {
	public $HisEn;	// Entity
	public $HisEnDtl;	// Entity
	protected $_SysPara;	// Row
	private function __init() { // default class members
		$this->HisEn = NULL;
		$this->HisEnDtl = NULL;
		$this->_SysPara = NULL;
	}
	abstract function getFormDtlMark (); 
	public function getSysPara () 
	{
		if (($this->_SysPara == NULL))
		{
			$this->_SysPara = new Row();
		}
		return $this->_SysPara;
	}
	public function setSysPara ($value) // [Row value]
	{
		$this->_SysPara = $value;
	}
	public function getFK_Mapdata () 
	{
		return $this->GetValStr("FK_MapData");
	}
	public function getFK_MapDtl () 
	{
		return $this->GetValStr("FK_MapDtl");
	}
	public function getOID () 
	{
		return $this->GetValInt("OID");
	}
	public function getOIDOfMainEn () 
	{
		return $this->GetValInt("OIDOfMainEn");
	}
	public function GetValDateTime ($key) // [String key]
	{
		try 
		{
			$str = $this->getSysPara()->GetValByKey($key);
			return $DataType->ParseSysDateTime2DateTime($str);
		}
		catch (\RuntimeException $ex)
		{
			throw new \RuntimeException(((("@表单从表事件实体在获取参数期间出现错误，请确认字�?(" . $key) . ")是否拼写正确,�?术信�?:") . $ex->getMessage()));
		}
	}
	public function GetValStr ($key) // [String key]
	{
		try 
		{
			return $this->getSysPara()->GetValByKey($key);
		}
		catch (\RuntimeException $ex)
		{
			throw new \RuntimeException(((("@表单从表事件实体在获取参数期间出现错误，请确认字�?(" . $key) . ")是否拼写正确,�?术信�?:") . $ex->getMessage()));
		}
	}
	public function GetValInt64 ($key) // [String key]
	{
		return $Long->parseLong($this->GetValStr($key));
	}
	public function GetValInt ($key) // [String key]
	{
		return $Integer->parseInt($this->GetValStr($key));
	}
	public function GetValBoolen ($key) // [String key]
	{
		if (($Integer->parseInt($this->GetValStr($key)) == 0))
		{
			return  FALSE ;
		}
		return  TRUE ;
	}
	public function GetValDecimal ($key) // [String key]
	{
		return $this->GetValDecimal($key);
	}
	public static function constructor__ () 
	{
		$me = new self();
		$me->__init();
		return $me;
	}
	public function FrmLoadAfter () 
	{
		return NULL;
	}
	public function FrmLoadBefore () 
	{
		return NULL;
	}
	public function BeforeFormDel () 
	{
		return NULL;
	}
	public function AfterFormDel () 
	{
		return NULL;
	}
	public function AthUploadeBefore () 
	{
		return NULL;
	}
	public function AthUploadeAfter () 
	{
		return NULL;
	}
	public function RowSaveBefore () 
	{
		return NULL;
	}
	public function RowSaveAfter () 
	{
		return NULL;
	}
	public function DtlRowDelBefore () 
	{
		return NULL;
	}
	public function DtlRowDelAfter () 
	{
		return NULL;
	}
	public function CreateOID () 
	{
		return NULL;
	}
	public function DoIt ($eventType, $en, $enDtl, $atPara) // [String eventType, Entity en, Entity enDtl, String atPara]
	{
		$this->HisEn = $en;
		if (($en == NULL))
		{
			return NULL;
		}
		$r = $en->getRow();
		try 
		{
			$r->put("FK_MapData", $en->getClassID());
		}
		catch (\Exception $e)
		{
			$r->put("FK_MapData", $en->getClassID());
		}
		if (($atPara . NULL))
		{
			$ap = new AtPara($atPara);
			foreach ($ap->getHisHT()->keySet() as $s) 			{
				try 
				{
					$r->put($s, $ap->GetValStrByKey($s));
				}
				catch (\Exception $e2)
				{
					$r->put($s, $ap->GetValStrByKey($s));
				}
			}
		}
		if ((SystemConfig::getIsBSsystem() ==  TRUE ))
		{
			$enu = Glo->getRequest()->getParameterNames();
			while ($enu->hasMoreElements()) 
			{
				$key = $enu->nextElement();
				$r->put($key, Glo->getRequest()->getParameter($key));
			}
		}
		$this->setSysPara($r);
		switch ($eventType) {
			case FrmEventListDtl::$RowSaveBefore:
				return $this->RowSaveBefore();
			case FrmEventListDtl::$RowSaveAfter:
				return $this->RowSaveAfter();
			case FrmEventListDtl::$DtlRowDelBefore:
				return $this->DtlRowDelBefore();
			case FrmEventListDtl::$DtlRowDelAfter:
				return $this->DtlRowDelAfter();
			default:
				throw new \RuntimeException(("@没有判断的表单从表事件类�?:" . $eventType));
		}
	}
}
?>
